<template>
	<div class="main">
		<div class="top">
			<div class="lf-title">{{ userInfo?.unitName }}</div>
			<div class="rg-date">{{ nowTime }} {{ xqTime }}</div>
			<div class="rg-date_sfm">{{ jtTime }}</div>
			<div class="top_name">
				{{ userInfo?.name || "" }}
			</div>
		</div>

		<div class="body_content">
			<div class="content">
				<!-- 左侧 -->
				<div class="left">
					<div class="zyzffb">

						<!-- 左侧-罪犯数据 -->
						<div style="width: 100%" class="box_zfsj">
							<div class="tit_bg">
								<img class="img_inco" src="../assets/images/zdzfIncoBg.png" alt="" />
								<div class="ba_text">罪犯数据</div>
							</div>
							<div class="zfsj_data">
								<div class="zfsj_item">
									在册：{{ CriminalNumCountForm.mzc || 0 }}
								</div>
								<div class="zfsj_item">
									在押：{{CriminalNumCountForm.mzy || 0 }}
								</div>
								<div class="zfsj_item">
									暂外执行：{{ CriminalNumCountForm.zwzx || 0 }}
								</div>
								<div class="zfsj_item">
									解回再审：{{ CriminalNumCountForm.jhzs || 0 }}
								</div>
								<div class="zfsj_item">
									离监就医：{{ CriminalNumCountForm.jwzy || 0 }}
								</div>
								<div class="zfsj_item">
									离监探亲：{{ CriminalNumCountForm.ljtq || 0 }}
								</div>
								<div class="zfsj_item">
									特许离监：{{ CriminalNumCountForm.txlj || 0 }}
								</div>

								<div class="zfsj_item">
									监外执行：{{ CriminalNumCountForm.jwzx || 0 }}
								</div>

								<div class="zfsj_item">
									逃跑犯人：{{ CriminalNumCountForm.tpfr || 0 }}
								</div>
								<div class="zfsj_item">
									刑满罪犯：{{ CriminalNumCountForm.jrxm || 0 }}
								</div>
								<div class="zfsj_item">
									新收押：{{ CriminalNumCountForm.xsy || 0 }}
								</div>
							</div>
						</div>

						<!-- 左侧-重点罪犯 -->
						<div style="width: 100%" class="bot_item" @click="dialogVisible3 = true">
							<div class="tit_bg">
								<img class="img_inco" src="../assets/images/zdzfIncoBg.png" alt="" />
								<div class="ba_text">重点罪犯</div>
							</div>
							<div class="zdrt_data flex_center_center">
								<div class="items flex_center_center">
									<div class="tits">监区</div>
									<div>{{ jqzdNub }}</div>
								</div>
								<div class="items flex_center_center" style="border-color: #cc9206; color: #cc9206">
									<div class="tits">监狱</div>
									<div>{{ jyzdNub }}</div>
								</div>
							</div>
						</div>

						<!-- 左侧-处遇等级 -->
						<div style="width: 100%" class="bot_item2" @click="dialogVisible2 = true">
							<div class="tit_bg">
								<img class="img_inco" src="../assets/images/cydjIncoBg.png" alt="" />
								<div class="ba_text">处遇等级</div>
							</div>
							<div class="box_cydj">
								<div class="cydj_data flex_bw_center">
									<div class="flex_start_center">
										<div class="data_item flex_start_center" v-for="(item, index) in cyArr"
											:key="index + item.num">
											<span class="item_text"> {{ item.cylevel }}</span>
											<span> {{ item.num }}</span>
										</div>
									</div>
								</div>
							</div>
						</div>

						<!-- 左侧-情况收集 -->
						<div class="ycqk_box">
							<div class="tit_bg" @click="dialogVisible7 = true">
								<img style="margin-left: 2px" class="img_inco" src="../assets/images/gzqkIncoBg.png"
									alt="" />
								<div class="ba_text">情况收集</div>
							</div>
							<div class="yc_table">
								<div class="table_item flex_start_center" v-for="(item, index) in qksjArr"
									:key="index + item.reportUser">
									<div style="width: 14%; margin-left: 10px">
										{{ item.orgName }}
									</div>
									<div style="width: 30%; color: #e42b2b">
										{{ item.createDate.split("T")[0] +  " " + item.createDate .split("T")[1].split("T")[0]   .split(":")[0] +
                      " " +item.createDate.split("T")[1].split("T")[0].split(":")[1] }}
									</div>

									<div style="text-align: center; width: 30%">
										{{ item.exceptType }}
									</div>

									<div style="width: 36%">
										<div v-if="item.content.length < 8">
											{{ item.content }}
										</div>
										<div v-else>
											{{ item.content.substring(0, 8) + "..." }}
										</div>
									</div>
								</div>
							</div>
						</div>

						<div class="operation">
							<div class="btn_box">
								<div class="btn_items">
									<el-button @click="doLogout" style="width: 100%" type="danger" plain>退出</el-button>
								</div>
								<div class="btn_items">
									<el-button @click="navUrl" style="width: 100%" type="warning" plain>管理</el-button>
								</div>
								<div class="btn_items">
									<el-button @click="CriminalTpfrClick()" style="width: 100%" type="warning"
										plain>逃跑犯人</el-button>
								</div>
								<!-- <div class="btn_items">
									<el-button @click="navUrl" style="width: 100%" type="warning" plain>值班日志</el-button>
								</div> -->
							</div>
						</div>
					</div>
				</div>

				<!-- 中间 -->
				<div class="center">
					<div class="cc-top">
						<el-table :data="tableDatas" style="width: 100%" border class="sjzx" height="540"
							@header-click="headerClick">
							<el-table-column :label="getsLabel(hour)" align="center">
								<template #default="scope">
									<div style="font-weight: bold" @click="zfsjTableClick(scope.row.name)">
										{{ scope.row.name }}
									</div>
								</template>
							</el-table-column>

							<el-table-column prop="" label="罪犯" align="center">
								<el-table-column prop="name" label="在册" align="center" width="60">
									<template #default="scope">
										<div v-if="scope.$index == 11">{{ getHzFun("zcfr") }}</div>
										<div v-else>
											{{ scope.row.zcfr }}
										</div>
									</template>
								</el-table-column>

								<el-table-column prop="zy" label="在押" align="center" width="60">
									<template #default="scope">
										<div v-if="scope.$index == 11">{{ getHzFun("zyfr") }}</div>
										<div v-else>
											{{ scope.row.zyfr }}
										</div>
									</template>
								</el-table-column>

								<el-table-column align="center" prop="jwzy" label="离监就医">
									<template #default="scope">
										<div v-if="scope.$index == 11">
											{{ getHzFun("jwzy") }}
										</div>
										<div v-else>
											{{ scope.row.jwzy }}
										</div>
									</template>
								</el-table-column>
								<el-table-column align="center" prop="jwzx" label="监外执行">
									<template #default="scope">
										<div v-if="scope.$index == 11">
											{{ getHzFun("jwzx") }}
										</div>
										<div v-else>
											{{ scope.row.jwzx }}
										</div>
									</template>
								</el-table-column>
								<el-table-column align="center" prop="jhzs" label="解回再审">
									<template #default="scope">
										<div v-if="scope.$index == 11">
											{{ getHzFun("jhzs") }}
										</div>
										<div v-else>
											{{ scope.row.jhzs }}
										</div>
									</template>
								</el-table-column>
								<el-table-column align="center" prop="tpfr" label="逃跑罪犯">
									<template #default="scope">
										<div v-if="scope.$index == 11">
											{{ getHzFun("tpfr") }}
										</div>
										<div v-else>
											{{ scope.row.tpfr }}
										</div>
									</template>
								</el-table-column>
								<el-table-column align="center" prop="jrxm" label="刑满罪犯">
									<template #default="scope">
										<span v-if="getxmzf(scope.row.name) !== 0">
											{{ getxmzf(scope.row.name) }}</span>
										<span v-else> {{ "--" }}</span>
									</template>
								</el-table-column>
							</el-table-column>

							<el-table-column prop="" label="警力" align="center" width="60">
								<el-table-column align="center" prop="jl" label="在册">
									<template #default="scope">
										{{ scope.row.jl}}
									</template>
								</el-table-column>

								<el-table-column align="center" prop="jlzdb" label="值班">
									<template #default="scope">
										{{ scope.row.jlzdb}}
									</template>
								</el-table-column>
							</el-table-column>
						</el-table>
					</div>

					<div class="center_db">
						<!-- 中间-特警队巡更 -->
						<div class="Items">
							<div class="tit_bg">
								<img class="img_inco" src="../assets/images/zfqkIncoBg.png" alt="" />
								<div class="ba_text">特警队巡更</div>
							</div>
							<div class="tjd_box flex_bw_start">
								<div class="item_sw">
									<div class="tjd_conten">
										<div class="colmm_box flex_start_start">
											<div style="width: 40%">09:00 - 10:00</div>
											<div style="width: 15%">3</div>
											<div style="width: 14%">张三</div>
										</div>
										<div class="colmm_box flex_start_start">
											<div style="width: 40%">10:00 - 11:00</div>
											<div style="width: 15%">3</div>
											<div style="width: 14%">李四</div>
										</div>
									</div>
								</div>
							</div>
						</div>

						<!-- 中间-应急物资 -->
						<div class="yjwz_box">
							<div class="tit_bg" @click="dialogVisible16 = true">
								<img style="margin-left: 2px" class="img_inco" src="../assets/images/gzqkIncoBg.png"
									alt="" />
								<div class="ba_text">应急物资</div>
							</div>
							<div class="yjwz_table">
								<div class="yjwz_bg">
									<div class="wz_item flex_start_start" v-for="(item, index) in cmdPropertyStatic"
										:key="index">
										<div style="width: 80%">
											{{ item.value }}
										</div>
										<div style="width: 20%">
											{{ item.propertyRestNum }}
										</div>
									</div>
								</div>
							</div>
						</div>

						<!-- 中间-应急预案 -->
						<div class="zw_box">
							<div class="tit_bg">
								<img class="img_inco" src="../assets/images/zfqkIncoBg.png" alt="" />
								<div class="ba_text">应急预案</div>
							</div>

							<div class="yjya_box">
								<div class="yjya_left">
									<div class="img_box">
										<img src="../assets/images/fa.png" alt="" srcset="" />
									</div>
									<div class="img_box">
										<img src="../assets/images/lct.png" alt="" srcset="" />
									</div>
									<div class="img_box">
										<img src="../assets/images/kdt.png" alt="" srcset="" />
									</div>
								</div>
								<div class="yjya_cen">
									<div class="img_box">
										<img src="../assets/images/yjya.png" alt="" srcset="" />
									</div>
								</div>
								<div class="yjya_rfiht">
									<div class="img_box">
										<img src="../assets/images/jyw.png" alt="" srcset="" />
									</div>
									<div class="img_box">
										<img src="../assets/images/bgq.png" alt="" srcset="" />
									</div>
									<div class="img_box">
										<img src="../assets/images/gqn.png" alt="" srcset="" />
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>

				<!--右侧 -->
				<div class="right">
					<!-- 右侧-民警数据 -->
					<div class="mjsj_box">
						<div class="tit_bg">
							<img class="img_inco" src="../assets/images/gzqkIncoBg.png" alt="" />
							<div class="ba_text">民警数据</div>
						</div>

						<div class="flex_bw_center mjsj_data">
							在册: {{CriminalNumCountForm.mjzc || 0 }}
							&nbsp;
							&nbsp;
							值班: {{CriminalNumCountForm.mjzb || 0 }}
						</div>
					</div>

					<!-- 右侧-指挥中心值班 -->
					<div class="zhzx_box">
						<div class="tit_bg" @click="getZtFun">
							<img style="margin-left: 2px" class="img_inco" src="../assets/images/zhzxIncoBg.png"
								alt="" />
							<div class="ba_text">指挥中心值班</div>
						</div>

						<div class="zhzx_data">
							<div class="jrzb_data jrzb-table" style="height: 100%">
								<div class="mj_box flex_start_start">

									<div class="mj_conten">
										<div class="mj_item flex_start_start" v-for="(item, index) in zbClassList"
											:key="index">
											<div class="mj_title">{{ item.name }}</div>
											<div class="mj_bc">{{ item.children[0].name }}</div>
											<div class="mj_name">
												{{ textData("", item.children[0].id) }}
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>

					<!-- <div class="bm_box">
						<div class="tit_bg" @click="getZtFun">
							<img style="margin-left: 2px" class="img_inco" src="../assets/images/zhzxIncoBg.png"
								alt="" />
							<div class="ba_text">XX(未确认)</div>
						</div>

						<div class="bm_data">
							<div class="bm_item">

							</div>
						</div>
					</div> -->


					<!-- 右侧-监区值班 -->
					<div class="jrzb">
						<div class="tit_bg" @click="dialogVisible17 = true">
							<img class="img_inco" src="../assets/images/gzqkIncoBg.png" alt="" />
							<div class="ba_text">监区值班</div>
						</div>
						<div class="jrzb_mian">
							<div class="top_box flex_start_start">
								<div class="flex_center_center items">
									<img src="../assets/images/ty.png" alt="" />
									<div>09：10-16：30</div>
								</div>
								<div class="flex_center_center items">
									<img src="../assets/images/yl.png" alt="" />
									<div>16：30-09：10（次）</div>
								</div>
							</div>
							<div class="jrzb-table">
								<el-table class="jrzb-table-list" :data="dataLists" border style="width: 100%"
									height="410">
									<el-table-column prop="" label="" width="74">
										<template #default="scope">
											<div>
												{{ scope.row.data }}
											</div>
										</template>
									</el-table-column>
									<el-table-column v-show="jqzbList.length" v-for="(item, index) in jqzbList"
										:key="index" :label="item.name" align="center">
										<template #default="scope">
											<div>
												{{ getUesrIs(scope, "白班") }}
											</div>
										</template>
									</el-table-column>

									<el-table-column v-show="jqzbList.length" v-for="(item, index) in jqzbList"
										:key="index" :label="item.name" align="center">
										<template #default="scope">
											<div>
												{{ getUesrIs(scope, "夜班") }}
											</div>
										</template>
									</el-table-column>
								</el-table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- 整点状态弹窗 -->
	<div v-if="dialogVisible1" class="dialog_boxs">
		<el-dialog top="60px" title="监区整点罪犯数据" width="1440" :show-close="false" v-model="dialogVisible1">
			<div class="jrzb-table" style="height: 740px; padding: 0 10px">
				<el-table :data="tableDatasCv" height="660" style="width: 100%; margin-top: 10px" border class="sjzx">
					<el-table-column prop="name" label="监区" width="90" align="center">
						<template #default="scope">
							<div style="font-weight: bold; color: #ccc">
								{{ scope.row.name }}
							</div>
						</template>
					</el-table-column>

					<el-table-column prop="name" label="在册" align="center">
						<template #default="scope">
							<div>{{ scope.row.zcfr }}</div>
						</template>
					</el-table-column>
					<el-table-column prop="zy" label="在押" align="center">
						<template #default="scope">
							{{ scope.row.zyfr }}
						</template>
					</el-table-column>
					<el-table-column prop="syfr" label="实押" align="center">
					</el-table-column>

					<el-table-column align="center" prop="jnzy" label="监内住院" />
					<el-table-column align="center" prop="ljtq" label="离监探亲" />
					<el-table-column align="center" prop="jbfr" label="监内禁闭" />
					<el-table-column align="center" prop="cjxd" label="惩戒训导" />
					<el-table-column align="center" prop="jwzy" label="监外住院" />
					<el-table-column align="center" prop="jwzx" label="监外执行" />
					<el-table-column align="center" prop="tpfr" label="逃跑犯">
					</el-table-column>
				</el-table>
			</div>
		</el-dialog>
	</div>

	<!-- 处遇等级 -->
	<div v-if="dialogVisible2" class="dialog_boxs">
		<el-dialog top="60px" title="处遇等级" width="1440" v-model="dialogVisible2">
			<zfxx style="height: 767px" isCode="jnzy,ljtq,jbfr,cjxd,jwzx,jhzs,zcfr,zyfr,syfr" :jqArr="jqArr" />
		</el-dialog>
	</div>

	<!-- 重点罪犯 -->
	<div v-if="dialogVisible3" class="dialog_boxs">
		<el-dialog top="60px" title="重点罪犯" width="1440" v-model="dialogVisible3">
			<zdzf style="height: 767px" :jqArr="jqArr" />
		</el-dialog>
	</div>

	<!-- 罪犯信息 -->
	<div v-if="dialogVisible4" class="dialog_boxs">
		<el-dialog title="罪犯信息" top="60px" width="1440" v-model="dialogVisible4">
			<zfxx :isCode="isCode" :jqArr="jqArr" />
		</el-dialog>
	</div>

	<!--罪犯状态  -->
	<div v-if="dialogVisible6">
		<el-dialog top="60px" title="罪犯状态" width="1152" v-model="dialogVisible7" style="height: 648px">
			<zfzt style="height: 605px" :jqArr="jqArr" :zfztText="zfztText" />
		</el-dialog>
	</div>

	<!-- 罪犯情况 -->
	<div>
		<el-dialog top="60px" title="情况收集" width="1440" v-model="dialogVisible7" style="height: 810px">
			<ycsb style="height: 743px" :jqArr="jqArr" :orgIds="orgIds" />
		</el-dialog>
	</div>

	<!-- 应急预案 -->
	<el-dialog top="60px" v-model="dialogVisible10" class="jjb" :title="yjTitle" width="1300">
		<yjya :jqArr="jqArr" :title="yjTitle" />
	</el-dialog>

	<!-- 值班选人弹窗 -->
<!-- 	<el-drawer v-model="dialogVisible12" title="指挥中心值班">
		<el-form ref="ruleFormRef" :model="formData" label-position="right" label-width="120px" class="dd-edit-box">
			<div v-for="item in zbClassList" :key="item.id">
				<div style="margin-bottom: 10px">{{ getlabel(item) }}</div>
				<el-form-item v-for="it in item.children" :key="it.id" :label="it.name" :prop="`${it.id}`">
					<el-cascader placeholder="请选择" :show-all-levels="false" v-model="formData[`${it.id}`]"
						:props="defaultProps" :options="policeList" @change="handleClick" style="width: 320px"
						filterable :clearable="false">
					</el-cascader>
				</el-form-item>
			</div>
		</el-form>
		<template #footer>
			<div class="dialog-footer">
				<el-button type="primary" @click="zbSave(ruleFormRef)">
					保存
				</el-button>
			</div>
		</template>
	</el-drawer> -->

	<!-- 交接班 -->
	<div v-if="dialogVisible13" class="dialog_boxs">
		<el-dialog v-model="dialogVisible13" width="1440" top="60px" title="指挥中心值班日志" style="height: 810px">
			<zhzxJjb :dialogVisible10="dialogVisible13" :account="userInfo?.account" :orgIds="userInfo?.orgId"
				@childEvent="sonClick" orgName="指挥中心" :pidObj="pidObj" :pids="pids" :jgqkList="jgqkList"
				style="height: 743px" :jqqkList="ycqkList" :sonTableData="sonTableData" :ldbcObj="ldbcObj" />
		</el-dialog>
	</div>

	<!-- 今日刑满 -->
	<div v-if="dialogVisible14" class="dialog_boxs">
		<el-dialog v-model="dialogVisible14" width="1152" top="60px" title="今日刑满" style="height: 648px">
			<jrxmDialog style="height: 605px" :jqArr="jqArr" />
		</el-dialog>
	</div>

	<!-- 罪犯状态 监区 -->
	<div v-if="dialogVisible15" class="dialog_boxs">
		<el-dialog v-model="dialogVisible15" width="1152" top="60px" :title="`罪犯状态（${zfText}）`" style="height: 810px">
			<zfztDialog style="height: 743px" :zfText="zfText" :jqArr="jqArr" />
		</el-dialog>
	</div>

	<!-- 应急物资 -->
	<div v-if="dialogVisible16" class="dialog_boxs">
		<el-dialog v-model="dialogVisible16" width="1440" top="60px" :title="`应急物资`" style="height: 810px">
			<yjwz style="height: 743px" :jqArr="jqArr" :dialogVisible16="dialogVisible16" />
		</el-dialog>
	</div>

	<!-- 监区值班人员 -->
	<div v-if="dialogVisible17" class="dialog_boxs">
		<el-dialog v-model="dialogVisible17" width="1440" top="60px" :title="`监区值班人员`" style="height: 810px">
			<jqzbRy style="height: 743px" :jqArr="jqArr" :orgIds="userInfo?.orgId" :dialogVisible16="dialogVisible17" />
		</el-dialog>
	</div>

	<!-- 逃跑犯人 -->
	<div>
		<el-dialog class="dialog_boxs" top="60px" title="逃跑犯人" center="true" width="1440" v-model="CriminalTpfrVisible">
			<criminalTpfr style="height: 767px;" :orgIds="orgIds" />
		</el-dialog>
	</div>

</template>
<script setup>
	import {
		Back,
		Right,
	} from "@element-plus/icons-vue";

	import {
		onMounted,
		ref,
		reactive,
		nextTick,
		onBeforeMount,
		watch
	} from "vue";
	import router from "@/router";
	import _ from "lodash";
	import http from "@/utils/api";
	import zdzf from "../components/zdzf.vue";
	import zfxx from "../components/zfxx.vue";
	import zfzt from "../components/zfzt.vue";
	import ycsb from "../components/ycsb.vue";
	import yjya from "../components/yjya.vue";
	import zhzxJjb from "../components/zhzxJjb.vue";
	import jrxmDialog from "../components/Criminal/jrxmDialog.vue";
	import zfztDialog from "../components/zfztDialog.vue";
	import yjwz from "../components/yjwz.vue";
	import jqzbRy from "../components/jqzbRy.vue";

	import criminalTpfr from "../components/Criminal/CriminalTpfrManage.vue";

	import {
		ElMessage,
		ElMessageBox
	} from "element-plus";
	const dialogVisible1 = ref(false);
	const dialogVisible2 = ref(false);
	const dialogVisible3 = ref(false);
	const dialogVisible4 = ref(false);
	const dialogVisible6 = ref(false);
	const dialogVisible7 = ref(false);
	const dialogVisible10 = ref(false)
	const dialogVisible12 = ref(false);
	const dialogVisible13 = ref(false);
	const dialogVisible14 = ref(false);
	const dialogVisible15 = ref(false);
	const dialogVisible16 = ref(false);
	const dialogVisible17 = ref(false);

	const CriminalTpfrVisible = ref(false); //逃跑犯人

	let textHour = ref("");
	let yjTitle = ref("");
	let zfztText = ref("");
	let tableDatas = reactive([{
		jq: "",
		name: "--",
		syfr: "--",
		tpfr: "--",
		zcfr: "--",
		zyfr: "--",
		jbfr: "--",
		cjxd: "--",
		jnzy: "--",
		jrxm: "--",
		jwzx: "--",
		jhzs: "--",
		jwzy: "--",
		ljtq: "--",
		jl: "--",
		jlzdb: "--",
		dc: "--",
	}, ]);

	const defaultProps = {
		children: "children",
		label: "name",
		value: "account",
		multiple: true,
		emitPath: false,
	};

	//整点计时器
	let intervalId = ref(null);
	let hours; // 定义一个全局变量

	let isNumber = ref(0);

	//整点计时器
	const checkAndExecuteAtTime = () => {
		const targetTimes = [
			"7:59",
			"8:59",
			"9:59",
			"10:59",
			"11:59",
			"12:59",
			"13:59",
			"14:59",
			"15:59",
			"16:59",
			"16:59",
			"17:59",
			"18:59",
			"19:59",
			"20:59",
			"21:59",
		];
		const now = new Date();
		const currentTime = `${now.getHours()}:${now
    .getMinutes()
    .toString()
    .padStart(2, "0")}`;
		if (targetTimes.includes(currentTime) && isNumber.value < 1) {
			isNumber.value += 1;
			setTimeout(() => {
				isNumber.value = 0;
			}, 46000);
			OrgSelect();
		} else {}

		// 销毁上一次的计时器
		clearInterval(intervalId.value);
		// 创建新的计时器
		intervalId.value = setInterval(checkAndExecuteAtTime, 46000);
	};

	let CriminalNumCountForm = ref({});

	const getCriminalNumCount = async () => {
		let res = await http.zfpt.CriminalNumCount({
			orgId: sessionStorage.getItem("orgIds"),
			date: daydata.value,
			state: "",
		});
		if (res && res.code == 0) {
			CriminalNumCountForm.value = res.data;
			console.log(CriminalNumCountForm.value)
			let arrs = [];
			res.data.forEach((itz) => {
				if (itz.state == "mzc") {
					CriminalNumCountForm.value.mzc = itz.total
				}
				if (itz.state == "mzy") {
					CriminalNumCountForm.value.mzy = itz.total
				}
				if (itz.state == "jwzy") {
					CriminalNumCountForm.value.jwzy = itz.total
				}
				if (itz.state == "jwzx") {
					CriminalNumCountForm.value.jwzx = itz.total
				}
				if (itz.state == "jhzs") {
					CriminalNumCountForm.value.jhzs = itz.total
				}
				if (itz.state == "tpfr") {
					CriminalNumCountForm.value.tpfr = itz.total
				}
				if (itz.state == "jrxm") {
					CriminalNumCountForm.value.jrxm = itz.total
				}
				if (itz.state == "xsy") {
					CriminalNumCountForm.value.xsy = itz.total
				}
				if (itz.state == "mjzc") {
					CriminalNumCountForm.value.mjzc = itz.total
				}
				if (itz.state == "mjzb") {
					CriminalNumCountForm.value.mjzb = itz.total
				}
			});

		}
	};





	let dateSfm = ref("");
	let hour = ref("");
	let daydata = ref("");
	const handleClick = (row) => {};
	const startChecking = () => {
		intervalId.value = setInterval(checkAndExecuteAtTime, 45000); // 每2分钟检查一次
	};

	// 获取年月日 时
	const getFormattedDateTime = () => {
		const now = new Date();
		const year = now.getFullYear();
		const month = String(now.getMonth() + 1).padStart(2, "0");
		const day = String(now.getDate()).padStart(2, "0");
		const hours = String(now.getHours()).padStart(2, "0");
		textHour.value = hours;
		const minutes = String(now.getMinutes()).padStart(2, "0");
		const seconds = String(now.getSeconds()).padStart(2, "0");
		dateSfm.value = `${hours}:${minutes}:${seconds}`;
		hour.value = String(now.getHours()).padStart(2, "0");
		daydata.value = `${year}-${month}-${day}`;
		return `${year}-${month}-${day} ${hour.value}`;
	};

	//上一次上报数据
	let clockList = ref([]);
	const writecope = (scope, label) => {
		if (scope[label] == "手动") {
			return "手动";
		} else if (scope[label] == "自动") {
			return "自动";
		} else {
			return "--";
		}
	};
	//整点时间判断
	const zdTiem = (row) => {
		if (Number(row.date.split(":")[0]) == Number(dateSfm.value.split(":")[0])) {
			return "rgb(2, 217, 2)";
		}
	};
	//异常详情回调
	let ycdetail = ref("");
	const nowTime = ref("");
	const xqTime = ref("");
	//格式化
	const complement = (value) => {
		return value < 10 ? `0${value}` : value.toString();
	};
	// 日期
	const nowTimes = ref("");
	const formateDate = () => {
		const time = new Date();
		const year = time.getFullYear();
		const month = complement(time.getMonth() + 1);
		const day = complement(time.getDate());
		nowTimes.value = `${year}-${month}-${day}`;
		return `${year}年${month}月${day}日`;
	};
	//星期
	const formatexqDate = () => {
		const time = new Date();
		const week = "星期" + "日一二三四五六".charAt(time.getDay());
		return week;
	};
	//在押罪犯人数
	let zyzfNums = ref("");
	let tableDatasCv = reactive([]);
	let hzObj = ref({});
	//获取已经上报的数据
	const ClockLasts = async (isDate = "", text = "") => {
		let strDate = "";
		tableData.value.forEach((item) => {
			strDate += "," + item.date.split(":")[0];
		});
		strDate = strDate.substring(4);

		let res = await http.zfpt.ClockLast({
			orgId: sessionStorage.getItem("orgIds"),
			date: nowTimes.value,
			hour: isDate ? isDate.split(":")[0] : strDate,
			async: "",
		});
		if (res.code == 0) {
			clockList.value = res.data;

			if (clockList.value.length) {
				if (isDate) {
					let arr = jqArr.value.map((item) => {
						return {
							name: item.name,
							syfr: "--",
							tpfr: "--",
							zcfr: "--",
							zyfr: "--",
							jbfr: "--",
							cjxd: "--",
							jnzy: "--",
							jrxm: "--",
							jhzs: "--",
							jwzy: "--",
							jwzx: "--",
							ljtq: "--",
							jl: "--",
							jlzdb: "--",
							jrxm: "--",
							dc: "--",
							orgId: item.id,
						};
					});
					tableDatas = reactive(arr);

					if (!text) {
						dialogVisible1.value = true;
					}
				}
				clockList.value.forEach((item) => {
					//当前点的数据
					if (
						Number(item.hour.split(":")[0]) ==
						(isDate ? Number(isDate.split(":")[0]) : hour.value)
					) {
						if (isDate) {
							textHour.value = isDate.split(":")[0];
						}

						tableDatas.forEach((iot) => {
							if (iot.name == item.orgName) {
								for (let key in iot) {
									if (item[key]) {
										iot[key] = item[key];
									}
								}
							}
						});
					}

					if (!isDate) {
						tableData.value.forEach((itz) => {
							if (
								Number(itz.date.split(":")[0]) == Number(item.hour.split(":")[0])
							) {
								jqArr.value.forEach((icz) => {
									if (icz.id == item.orgId) {
										let keyArr = Object.keys(itz);
										keyArr.forEach((keys) => {
											if (keys == icz.name) {
												if (item.async == 2) {
													itz[keys] = "自动";
												} else {
													itz[keys] = "手动";
												}
											}
										});
									}
								});
							}
						});
					}
				});
			}

			if (text) {
				tableDatasCv = tableDatas.filter((item) => item.name != "汇总");
				hzObj.value = {
					syfr: 0,
					tpfr: 0,
					zcfr: 0,
					zyfr: 0,
					jbfr: 0,
					cjxd: 0,
					jnzy: 0,
					jrxm: 0,
					jhzs: 0,
					jwzy: 0,
					jwzx: 0,
					ljtq: 0,
					jl: 0,
					jlzdb: 0,
					jrxm: 0,
					tpfr: 0
				};
				getTotalFun();
			}
		}
	};

	const getTotalFun = (code) => {
		let nub = 0;

		tableDatas.forEach((item) => {
			if (Number(item.syfr)) {
				hzObj.value.zyfr += Number(item.zyfr)
			}
			if (Number(item.zcfr)) {
				hzObj.value.zcfr += Number(item.zcfr)
			}
			if (Number(item.jwzy)) {
				hzObj.value.jwzy += Number(item.jwzy)
			}
			if (Number(item.jhzs)) {
				hzObj.value.jhzs += Number(item.jhzs)
			}
			if (Number(item.jwzx)) {
				hzObj.value.jwzx += Number(item.jwzx)
			}
			if (Number(item.tpfr)) {
				hzObj.value.tpfr += Number(item.tpfr)
			}
			if (Number(item.jrxm)) {
				hzObj.value.jrxm += Number(item.jrxm)
			}
			if (Number(item.dc)) {
				hzObj.value.dc += Number(item.dc)
			}
			if (Number(item.jl)) {
				hzObj.value.jl += Number(item.jl)
			}
			if (Number(item.jlzdb)) {
				hzObj.value.jlzdb += Number(item.jlzdb)
			}
		});

		return nub;
	};

	const getHzFun = (key) => {
		let nub = 0;
		tableDatas.forEach((item) => {
			if (item[key] != "--") {
				nub += Number(item[key]);
			}
		});
		return nub;
	};
	//中间数据
	let jqLists = ref([]);

	let dmName = ref("");
	let jqArr = ref([]);
	const idList = ref("");
	let tableData = ref([{
			date: "07:00",
		},
		{
			date: "08:00",
		},
		{
			date: "09:00",
		},
		{
			date: "10:00",
		},
		{
			date: "11:00",
		},
		{
			date: "12:00",
		},
		{
			date: "13:00",
		},
		{
			date: "14:00",
		},
		{
			date: "15:00",
		},
		{
			date: "16:00",
		},
		{
			date: "17:00",
		},
		{
			date: "18:00",
		},
		{
			date: "19:00",
		},
		{
			date: "20:00",
		},
		{
			date: "21:00",
		},
		{
			date: "22:00",
		},
	]);

	let sonTableData = ref([{
		jq: "",
		jrxm: "",
		name: "--",
		syfr: "--",
		tpfr: "--",
		zcfr: "--",
		zyfr: "--",
		jbfr: "--",
		cjxd: "--",
		jnzy: "--",
		jrxm: "--",
		jwzx: "--",
		jwzy: "--",
		ljtq: "--",
		jl: "--",
		dc: "--",
	}, ]);
	let sonBigArr = ref([]);

	const getZtFun = async () => {
		let res = await http.zfpt.ClockLast({
			orgId: sessionStorage.getItem("orgIds"),
			date: daydata.value,
			hour: hour.value,
			async: "",
		});
		if (res && res.code == 0) {
			sonBigArr.value = res.data;
			if (sonBigArr.value.length) {
				let arr = jqArr.value.map((item) => {
					return {
						name: item.name,
						syfr: "--",
						jqld: "",
						tpfr: "--",
						zcfr: "--",
						zyfr: "--",
						jbfr: "--",
						cjxd: "--",
						jnzy: "--",
						jrxm: "--",
						jwzx: "--",
						jhzs: "--",
						jwzy: "--",
						ljtq: "--",
						jl: "--",
						dc: "--",
						orgId: item.id,
					};
				});
				sonTableData.value = reactive(arr);

				sonBigArr.value.forEach((item) => {
					if (Number(item.hour.split(":")[0]) == hour.value) {
						sonTableData.value.forEach((iot) => {
							if (iot.name == item.orgName) {
								for (let key in iot) {
									if (item[key]) {
										iot[key] = item[key];
									}
								}
							}
						});
					}
				});
				sonTableData.value.forEach((item) => {
					jqzbRyArr.value.forEach((itz) => {
						if (item.name == itz.orgName) {
							if (itz.shiftName == "领导") {
								item["jqld"] += "," + itz.zbry;
							}
						}
					});
					item["jqld"] = item["jqld"].slice(1);
				});
			}
			dialogVisible13.value = true;
		}
	};

	let zbClassList = ref([]);
	let pidObj = ref({});

	let formData = reactive({});
	let policeList = ref([]);

	//值班切换人员
	const zbSave = async () => {
		let jsonArr = [];
		for (let key in formData) {
			let item = {
				shift: key,
				zbry: formData[key].join(","),
			};
			jsonArr.push(item);
		}

		let obj = {
			date: daydata.value,
			zbType: 1, //1:值班，2:带班，3:备勤
			type: "zhzx",
			orgId: sessionStorage.getItem("orgIds").split(",")[
				sessionStorage.getItem("orgIds").split(",").length - 1
			],
			json: JSON.stringify(jsonArr),
		};

		let res;
		if (jcNub.value) {
			res = await http.base.ZdbUpdate(obj);
		} else {
			res = await http.base.ZdbAdd(obj);
		}

		if (res.code == 0) {
			dialogVisible12.value = false;
			ElMessage({
				message: "保存成功",
				type: "success",
				plain: true,
			});
			getZdbSelect();
		}
	};

	const sonClick = (data) => {
		dialogVisible13.value = false;
	};

	let ldbcArr = ref([]);
	let ldryArr = ref([]);
	let ldIds = ref(0);
	let ldbcObj = ref({});
	//获取指挥中心值班
	const getLdShiftSelect = async () => {
		let resz = await http.znjw.ShiftSelect({
			type: "zhzxld",
			pId: 0,
			orgId: userInfo.value.orgId,
			startDate: "",
			endDate: "",
			isLock: 0,
			zbType: "1",
		});
		if (resz && resz.code == 0 && resz.data.length) {
			ldIds.value = resz.data[0]?.id;
			if (resz.data[0]?.children[0]?.children) {
				ldbcArr.value = resz.data[0].children[0].children;
			}
			ldbcObj.value = resz.data[0];
			sessionStorage.setItem("ldbcObj", JSON.stringify(ldbcObj.value));
		}
		let res = await http.znjw.ZdbSelect({
			type: "zhzxld",
			zbType: "1",
			orgId: sessionStorage.getItem("orgIds"),
			shift: ldIds.value,
			account: "",
			date: daydata.value,
		});
		if (!res) return;
		if (res.code == 0) {
			ldryArr.value = res.data;
		}
	};

	let bbArr = ref([]);
	let ybArr = ref([]);
	let listData = ref([]);
	const jcNub = ref(0);
	let pids = ref(0);
	let userInfo = ref({});

	//获取指挥中心
	const getZdbSelect = async () => {
		let resz = await http.znjw.ShiftSelect({
			type: "zhzx",
			pId: 0,
			orgId: userInfo.value.orgId,
			startDate: "",
			endDate: "",
			isLock: 0,
			zbType: "1",
		});
		if (resz && resz.code == 0 && resz.data.length) {
			pids.value = resz.data[0].id;
			pidObj.value = resz.data[0];
			zbClassList.value = resz.data[0].children;
			sessionStorage.setItem("pidObj", JSON.stringify(pidObj.value));
		}
		let res = await http.znjw.ZdbSelect({
			type: "zhzx",
			zbType: "1",
			orgId: sessionStorage.getItem("orgIds"),
			shift: pids.value,
			account: "",
			date: daydata.value,
		});
		if (!res) return;

		if (res.code == 0) {
			res.data.length &&
				res.data.forEach((item) => {
					item["zbryInfoArr"] =
						item?.zbry &&
						item.zbry.split(",").map((itz, index) => {
							return {
								name: item.zbry.split(",")[index],
								id: "",
								is: false,
								zbryAccount: item.zbryAccount.split(",")[index],
							};
						});
				});
			listData.value = res.data;

			bbArr.value = [];
			ybArr.value = [];
			listData.value.forEach((item) => {
				if (item.pshiftName == "白班") {
					bbArr.value.push(item);
				} else {
					ybArr.value.push(item);
				}
			});
			jcNub.value = 0;
			listData.value.forEach((item) => {
				if (item.zbry) {
					item.zbry.split(",").forEach((itz) => {
						jcNub.value += 1;
					});
				}
			});
		}
		//监区情况
		ExceptionReportSelect();
	};
	const textData = (row, id) => {
		let str = "";
		listData.value.forEach((item) => {
			if (item.shift == id) {
				str = item.zbry;
			}
		});
		return str;
	};
	const orgIds = ref("");
	let bigJqArr = ref([]);
	const OrgSelect = async () => {
		userInfo.value = JSON.parse(sessionStorage.getItem("userInfo"));
		let res = await http.base.OrgSelect({
			orgId: userInfo.value.unitId,
			type: "org",
			isLock: 0,
			level: 3,
			contain: "no",
		});
		if (!res) return;
		if (res.code == 0) {
			bigJqArr.value = res.data[0].children;
			let orgArr = res.data[0].children.filter((item) =>
				item.name.includes("监区")
			);
			jqArr.value = orgArr;
			sessionStorage.setItem("jqArr", JSON.stringify(bigJqArr.value));
			idList.value = res.data[0].children.map((item) => item.id);
			jqLists.value = orgArr.map((item) => item.name);
			jqLists.value = jqLists.value.reduce((acc, item) => {
				acc[item] = "--";
				return acc;
			}, {});

			let arr = jqArr.value.map((item) => {
				return {
					name: item.name,
					syfr: "--",
					tpfr: "--",
					zcfr: "--",
					zyfr: "--",
					jbfr: "--",
					cjxd: "--",
					jnzy: "--",
					jrxm: "--",
					jwzx: "--",
					jhzs: "--",
					jwzy: "--",
					ljtq: "--",
					orgId: item.id,
				};
			});
			tableDatas = reactive(arr);

			dataLists.value = jqArr.value.map((item) => {
				return {
					data: item.name,
				};
			});

			tableData.value = tableData.value.map((obj) => ({
				...obj,
				...jqLists.value,
			}));
			tableData.value.forEach((item) => {
				if (item) {
					for (let key in item) {
						if (!key.includes("监区")) {}
					}
				}
			});

			jqLists.value = Object.entries(jqLists.value).map(([key, value]) => ({
				[key]: value,
			}));
			if (clockList.value.length) {}
			orgIds.value = idList.value.join(",");
			sessionStorage.setItem("orgIds", orgIds.value);
			dmName.value = sessionStorage.getItem("dmName");

			//指挥中心值排班
			getZdbSelect();

			// CriminalStateStatic();
			//刑满
			CriminalZr();
			//监区值班
			ZdbSelect();
			// 处遇等级
			getCyLevelStatic();

			//重点罪犯
			getCriminalMainSelect();

			//监区整点数据
			dialogTableClick({
					date: String(hour.value).length < 2 ?
						"0" + hour.value + ":00" : String(hour.value) + ":00",
				},
				"初始化"
			);

			//领导值班
			getLdShiftSelect();

			//应急物资
			getPropertySelect();
		}
	};

	let emergencysupplyArr = ref([]);
	let cmdPropertyStatic = ref([]);
	const getPropertySelect = async () => {
		let strIds = "";
		let resc = await http.base.sysCmdTree({
			code: "emergencysupply",
			pId: 0,
			type: 24,
			value: "",
		});
		if (resc && resc.code == 0) {
			emergencysupplyArr.value = resc.data;

			if (emergencysupplyArr.value.length) {
				strIds = emergencysupplyArr.value
					.map((item) => {
						return item.id;
					})
					.join(",");
			}
		}

		let res1 = await http.base.SysCmdPropertyStatic({
			type: 24,
			code: ''
		})

		if (res1 && res1.code == 0) {
			cmdPropertyStatic.value = res1.data;
		}
	};


	const navUrl = (url) => {
		router.push("/towIndex");
	};

	const yjClick = (tit) => {
		dialogVisible10.value = true;
		yjTitle.value = tit;
	};

	let jqzdNub = ref(0);
	let jyzdNub = ref(0);

	const getCriminalMainSelect = async () => {
		let res = await http.zfpt.CriminalMainSelect({
			page: 1,
			limit: 999,
			name: "",
			orgId: sessionStorage.getItem("orgIds"),
			type: "jy,jq",
			startDate: "",
			endDate: "",
			state: "0",
		});

		if (res && res.code == 0) {
			res.data.data &&
				res.data.data.forEach((item) => {
					if (item.type == "jq") {
						jqzdNub.value += 1;
					}
					if (item.type == "jy") {
						jyzdNub.value += 1;
					}
				});
		}
	};

	let stateObj = ref({});

	let cyArr = ref([]);
	//处遇等级
	const getCyLevelStatic = async () => {
		let res = await http.zfpt.CyLevelStatic({
			orgId: sessionStorage.getItem("orgIds"),
		});
		if (res && res.code == 0) {
			cyArr.value = res.data;
		}
	};
	//值班查询
	const dataLists = ref([]);

	let jqzbRyArr = ref([]);
	let jqzbList = ref([]);
	const ZdbSelect = async () => {
		let resz = await http.znjw.ShiftSelect({
			type: "jq",
			pId: 0,
			orgId: 22,
			startDate: "",
			endDate: "",
			isLock: 0,
			zbType: "1",
		});
		if (resz && resz.code == 0) {
			if (resz && resz.data[0]?.children.length) {
				jqzbList.value = resz.data[0].children[0].children;
			}
		}

		let res = await http.znjw.ZdbSelect({
			type: "jq",
			zbType: "1",
			orgId: sessionStorage.getItem("orgIds"),
			shift: "",
			account: "",
			date: nowTimes.value,
		});
		if (!res) return;
		jqzbRyArr.value = res.data;

		let arr = [];
		arr = dataLists.value.filter((item) => item.data.includes("监区"))
		dataLists.value = arr;
	};

	const getUesrIs = (scp, text) => {
		let nub = 0;
		let str = "";
		if (scp.row?.data) {
			jqzbRyArr.value.forEach((item) => {
				if (scp.row.data == item.orgName) {
					if (item.pshiftName == text) {
						if (scp.column.label == item.shiftName) {
							str += " " + item.zbry;
							nub += 1;
						}
					}
				}
			});
		}
		if (str) {
			// console.log(str)
			return str;
			return str.split(",").length;
		} else {
			return str;
		}
	};


	//今日刑满
	const xmList = ref([]);
	const CriminalZr = async () => {
		let res = await http.znjw.CriminalZr({
			date: nowTimes.value,
			orgId: sessionStorage.getItem("orgIds"),
		});
		if (!res) return;
		if (res.code == 0) {
			if (!res.data.length) return;

			xmList.value = res.data;
			xmList.value.forEach((item) => {
				item["is"] = "";
			});
			let resc = await http.zfpt.CriminalSelect({
				page: 1,
				limit: 30,
				criminalNo: "",
				name: "",
				state: "lj",
				jsh: "",
				location: "",
				joinDate: daydata.value,
				orgId: sessionStorage.getItem("orgIds"),
			});
			if (resc.code == 0 && resc.data.data.length) {
				resc.data.data.forEach((item) => {
					xmList.value.forEach((itz) => {
						if (itz.provinceCode == item.provinceCode) {
							let strs = item.name + `(离监); `;
							itz["isName"] = strs;
							itz["is"] = "TRUE";
						}
					});
				});
			}
		}
	};

	//罪犯状态
	let zfStateList = ref([]);
	let result = ref("");
	const CriminalStateStatic = async () => {
		let res = await http.zfpt.ClockLast({
			orgId: sessionStorage.getItem("orgIds"),
			async: "",
			date: nowTimes.value,
			hour: String(hours - 1).padStart(2, "0"),
		});
		if (res.code == 0) {
			zyzfNums.value = 0;
			for (let i = 0; i < res.data.length; i++) {
				zyzfNums.value += res.data[i].zcfr;
			}
			res = res.data;
			const totalJbfr = res.reduce((accumulator, current) => {
				return accumulator + (current.jbfr || 0); // 确保 jbfr 存在且是数字
			}, 0);
			const totalcjxd = res.reduce((accumulator, current) => {
				return accumulator + (current.cjxd || 0); // 确保 jbfr 存在且是数字
			}, 0);
			const totaljnzy = res.reduce((accumulator, current) => {
				return accumulator + (current.jnzy || 0); // 确保 jbfr 存在且是数字
			}, 0);
			const totalljtq = res.reduce((accumulator, current) => {
				return accumulator + (current.ljtq || 0); // 确保 jbfr 存在且是数字
			}, 0);
			const totaljwzy = res.reduce((accumulator, current) => {
				return accumulator + (current.jwzy || 0); // 确保 jbfr 存在且是数字
			}, 0);
			const totaljwzx = res.reduce((accumulator, current) => {
				return accumulator + (current.jwzx || 0); // 确保 jbfr 存在且是数字
			}, 0);
			zfStateList.value = [
				totalJbfr,
				totalcjxd,
				totaljnzy,
				totalljtq,
				totaljwzy,
				totaljwzx,
			];
			const zfstate = ["紧闭", "惩戒", "内院", "探亲", "外院", "执行"];
			result.value = zfstate.map((zfstate, index) => ({
				name: zfstate,
				value: zfStateList.value[index] || 0,
			}));
		}
	};

	//逃跑罪犯
	const CriminalTpfrClick = () => {
		CriminalTpfrVisible.value = true;
	};

	//筛选当前时间上报数据
	const dialogTableClick = (row, text) => {
		if (row.date == "07:00") return;

		ClockLasts(row.date, text);
	};
	let qksjArr = ref([]);
	let jgqkList = ref([]);
	const jgExceptionReportSelect = async () => {
		let res = await http.znjw.ExceptionReportSelect({
			page: 1,
			limit: 999,
			orgId: sessionStorage.getItem("orgIds"),
			exceptType: "",
			startDate: pidObj.value.curStartDate || "",
			endDate: pidObj.value.curEndDate || "",
			state: "0",
			reportState: "1",
			reportType: "jg",
		});
		if (res && res.code == 0) {
			jgqkList.value = res.data.data;
			qksjArr.value = [...jgqkList.value, ...ycqkList.value];
		}
	};

	//异常情况
	const ycqkList = ref([]);
	const ExceptionReportSelect = async () => {
		let res = await http.znjw.ExceptionReportSelect({
			page: 1,
			limit: 999,
			orgId: sessionStorage.getItem("orgIds"),
			exceptType: "",
			startDate: pidObj.value.curStartDate || "",
			endDate: pidObj.value.curEndDate || "",
			state: "0",
			reportState: "1",
			reportType: "zf",
		});
		if (res && res.code == 0) {
			ycqkList.value = res.data.data;
			jgExceptionReportSelect();
		}
	};

	//确定退出
	const doLogout = async () => {
		ElMessageBox.alert("是否确认退出登录", "退出", {
			confirmButtonText: "确定",
			callback: (action) => {
				if (action == "confirm") {
					logout();
				}
			},
		});
	};
	const logout = async () => {
		let res = await http.logout();

		if (res.code == 0) {
			ElMessage({
				type: "success",
				message: "退出成功",
			});
			setTimeout(() => {
				sessionStorage.clear();
				router.push("/login");
			}, 1000);
		}
	};

	let zfText = ref("");

	const getsLabel = (nub) => {
		let str;
		if (nub) {
			str = String(nub).length == 1 ? "0" + nub + ":00" : String(nub) + ":00";
		}

		return str;
	};

	let isCode = ref("");

	const headerClick = (row) => {
		if (row.no == 0 && !row.property) {
			dialogTableClick({
				date: row.label,
			});
		}
		if (row.label == "刑满罪犯") {
			dialogVisible14.value = true;
		}
		if (
			row.label == "监内住院" ||
			row.label == "离监探亲" ||
			row.label == "监内禁闭" ||
			row.label == "惩戒训导" ||
			row.label == "监外住院" ||
			row.label == "监外执行" ||
			row.label == "解回再审" ||
			row.label == "夜巡人员" ||
			row.label == "逃跑犯"
		) {
			zfText.value = row.label;
			dialogVisible15.value = true;
		}
		if (row.label == "在册" || row.label == "实押" || row.label == "在押") {
			let str =
				row.label == "在册" ? "zcfr" : row.label == "实押" ? "syfr" : "zyfr";
			isCode.value = str;
			dialogVisible4.value = true;
		}
	};
	const zfsjTableClick = (row, clomm) => {
		if (row && row != "汇总") {
			zfztText.value = row;
			dialogVisible6.value = true;
		}
	};

	const getxmzf = (name) => {
		let nub = 0;
		if (xmList.value.length) {
			xmList.value.forEach((item) => {
				if (item.orgName == name) {
					nub += 1;
				}
			});
		}
		return nub;
	};

	watch(dialogVisible13, (newValue) => {
		if (!newValue) {
			getZdbSelect();
			getLdShiftSelect();
			//工作情况
			ExceptionReportSelect();
		}
	});

	const formatejtDate = () => {
		const time = new Date();
		const hour = complement(time.getHours());
		const minute = complement(time.getMinutes());
		const second = complement(time.getSeconds());
		return ` ${hour}:${minute}:${second}`;
	};

	onBeforeMount(() => {
		formateDate();
		// 整点计时器
		nextTick(startChecking);

	});
	let jtTime = ref("");
	onMounted(() => {
		getFormattedDateTime();
		if (sessionStorage.getItem("token")) {
			OrgSelect();
		}
		getCriminalNumCount();

		let timer = 0;
		timer = setInterval(() => {
			nowTime.value = formateDate();
			xqTime.value = formatexqDate();
			jtTime.value = formatejtDate();
		}, 1000);
	});
</script>

<style lang="scss" scoped>
	.operation {
		height: 40px;
		width: 100%;
		background-color: rgb(8, 38, 78);
		display: flex;
		flex-direction: row;

		.btn_box {
			height: 100%;
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			justify-content: flex-start;
			padding: 0 4px;

			.btn_items {
				width: 100px;
				height: 30px;
				margin-right: 10px;
			}
		}
	}

	::v-deep .el-table__body tr.current-row>td.el-table__cell {
		background-color: #f7f7f700 !important;
	}

	::v-deep .el-input__inner {
		background: none;
	}

	.mj_box {
		width: 100%;
		height: 130px;
		border: 1px solid rgb(5, 112, 146);

		.tiiles {
			font-weight: bold;
			width: 60px;
			color: white;
			height: 100%;
			border-right: 1px solid rgb(5, 112, 146);
		}

		.mj_conten {
			width: calc(100% - 0px);
			height: 100%;

			.mj_item {
				height: 32px;
				color: white;
				text-align: center;
				width: 100%;
				border-bottom: 1px solid rgb(5, 112, 146);
				line-height: 30px;

				.mj_title {
					width: 70px;
					height: 100%;
					border-right: 1px solid rgb(5, 112, 146);
				}

				.mj_bc {
					width: 70px;
					height: 100%;
					border-right: 1px solid rgb(5, 112, 146);
				}

				.mj_name {
					min-width: 70px;
					height: 100%;
					padding: 0 2px;
				}
			}
		}
	}

	::v-deep .jjb {
		.el-table .cell {
			font-size: 12px !important;
		}

		.el-table thead {
			color: #3e3e3e !important;
			display: none;
		}

		.el-table .el-table__cell {
			padding: 2px 4px;
		}

		.el-table td.el-table__cell div {
			box-sizing: border-box;

			height: auto;
			min-height: 30px;
		}

		.el-table td.el-table__cell .colmm_table {
			height: 300px;
		}
	}

	/**
 标签样式修改
 */
	::v-deep .el-tabs--card>.el-tabs__header .el-tabs__nav {
		border: 1px solid rgb(5, 112, 146) !important;
	}

	::v-deep .el-tabs--card>.el-tabs__header {
		border-bottom: 1px solid rgba(48, 104, 121, 0) !important;
	}

	::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item {
		color: white;
		border-left: 1px solid rgb(5, 112, 146) !important;
	}

	::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
		border-bottom-color: rgb(0, 247, 255) !important;
		color: rgb(0, 247, 255);
	}

	.zhzx_box {
		width: 100%;
		height: 202px;
		position: relative;
		padding: 12px 8px 0px 8px;

		.tit_bg {
			cursor: pointer;
			height: 16px;
			display: flex;
			align-items: center;
			margin-bottom: 2px;

			position: absolute;
			top: 6px;
			z-index: 99;
			left: 26px;
			padding-left: 6px;
			width: 126px;
			text-align: center;
			background: rgb(8, 38, 78);
		}

		.P_box {
			width: 59px;
			display: flex;
			border-top: 1px solid rgb(5, 112, 146);
			justify-content: center;
			border-right: 1px solid rgb(5, 112, 146);
			height: 100%;
			align-items: center;
		}

		.zhzx_data {
			width: 100%;
			height: calc(100% - 0px);
			border-top: 1px solid #073f97;
			padding-top: 18px;

			.data_title {
				height: 30%;
				width: 87%;
				margin-left: 13.2%;
				font-size: 12px;
				color: white;

				.items {
					text-align: center;
					width: 50%;
					height: 100%;
					border-right: 1px solid rgb(5, 112, 146);

					img {
						width: 14px;
						height: 14px;
					}
				}
			}

			.data_item {
				width: 102%;
				align-items: center;
				height: 45%;
				color: #fff;

				.left_box {
					width: 193px;
					border-right: 1px solid rgb(5, 112, 146);
					border-top: 1px solid rgb(5, 112, 146);
					padding-left: 12px;
				}
			}
		}
	}


	.bm_box {
		width: 100%;
		height: 302px;
		position: relative;
		padding: 12px 8px 0px 8px;

		.tit_bg {
			cursor: pointer;
			height: 16px;
			display: flex;
			align-items: center;
			margin-bottom: 2px;

			position: absolute;
			top: 6px;
			z-index: 99;
			left: 26px;
			padding-left: 6px;
			width: 126px;
			text-align: center;
			background: rgb(8, 38, 78);
		}

		.bm_data {
			width: 100%;
			height: calc(100% - 0px);
			border-top: 1px solid #073f97;
			padding-top: 18px;

			.bm_item {
				width: 100%;
				height: 30px;
				border: 1px solid red;
			}
		}
	}

	.img_inco {
		width: 16px;
		height: 16px;
		margin-right: 6px;
		margin-left: 2px;
	}

	.ba_text {
		font-size: 14px;
		font-family: headerFamily;
		background: linear-gradient(0deg,
				rgb(100, 255, 255) 0%,
				rgb(117, 246, 246) 50%,
				#ffffff 90%,
				#ffffff 100%);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
	}

	.isBolo {
		font-weight: bold;
	}

	.isAtvs {
		color: #aaaaaa !important;
	}

	.top_box {
		width: 315px;
		height: 28px;
		border: 1px solid rgb(5, 112, 146);
		margin-left: 75px;
		border-bottom: none;
		font-size: 12px;
		border-right: none;
		color: white;

		.items {
			text-align: center;
			width: 50%;
			height: 100%;
			border-right: 1px solid rgb(23, 88, 158);

			img {
				width: 16px;
				transform: translate(0px, 1px);
				height: 16px;
				margin-right: 2px;
			}
		}
	}

	.top_name {
		position: absolute;
		color: white;
		right: 270px;
		font-size: 18px;
		top: 76px;
		font-weight: bold;
		display: none;
	}

	::v-deep .el-table thead.is-group tr:first-of-type th:first-of-type {
		border-bottom: 1px solid rgb(5, 112, 146);
	}

	::v-deep .el-table thead.is-group tr:first-of-type th:first-of-type:before {
		opacity: 0;
	}

	::v-deep .el-table .el-table__cell {
		padding: 2px 0 !important;
	}

	::v-deep .el-table th.el-table__cell {
		background: #f5f7fa00 !important;
	}

	::v-deep .el-table {
		--el-table-row-hover-bg-color: transparent;
	}

	.main {
		margin: 0;
		padding: 0;
	}

	::v-deep .el-link {
		font-size: 12px !important;
	}

	::v-deep .sjzx {
		height: 100%;
		width: 100%;
		overflow: hidden;
		background: transparent !important;

		.el-table__header-wrapper {
			font-weight: bold;
		}

		.el-table-column {
			background: transparent !important;
		}

		.el-table__row {
			background: transparent !important;
		}

		.el-table__header {
			background: transparent !important;
		}

		.cell {
			background: transparent !important;
			color: #fff !important;
			text-align: center;
			line-height: 36px;
			font-size: 12px;
		}

		.el-table__cell {
			border-color: 1px solid rgb(5, 112, 146);
		}

		.el-table--fit .el-table__inner-wrapper:before {
			display: none !important;
		}

		.el-table th.el-table__cell.is-leaf {
			border: none !important;
		}

		--el-table-border-color: rgb(5, 112, 146);
	}

	::v-deep .el-table tr {
		background: transparent;
	}

	::v-deep .jrzb-table-list {
		height: 130%;
		width: 100%;
		overflow: hidden;
		background: transparent !important;

		.el-table__row {
			background: transparent !important;
		}

		.el-table__cell {
			border-color: 1px solid rgb(5, 112, 146);
		}

		.cell {
			color: #fff;
			text-align: center;
			line-height: 25px;
			display: flex;
			justify-content: center;
			/* 水平居中 */
			align-items: center;
			/* 垂直居中 */
			font-size: 12px !important;
		}

		--el-table-border-color: rgb(5, 112, 146);
	}

	::v-deep .jrzb-table {
		.el-table td.el-table__cell .text_name {
			box-sizing: border-box;
			height: 92px;
			line-height: 28px;
			color: white;
			overflow-y: scroll;
		}

		.el-table td.el-table__cell .table_name {
			box-sizing: border-box;
			height: 30px;
			overflow-y: scroll;
		}
	}

	.main {
		width: 100vw;
		height: 100vh;
		margin: 0;
		padding: 0;
		position: relative;
		background-color: rgb(3, 7, 21);
		overflow: hidden;

		.lf-title {
			width: 300px;
			position: absolute;
			top: 52px;
			right: 0px;
			color: #fff;
			font-size: 22px;
			text-align: center;
		}

		.rg-date {
			position: absolute;
			top: 46px;
			left: 110px;
			color: #fff;
			font-size: 22px;
		}

		.rg-date_sfm {
			position: absolute;
			top: 72%;
			left: 185px;
			color: #fff;
			font-size: 22px;
		}

		.top {
			width: 100%;
			height: 110px;
			background: url(../assets/images/topBg1.png) no-repeat no-repeat;
			background-size: 100% 100%;
			display: flex;
			align-items: center;
			position: relative;
			font-size: 22px;
			justify-content: space-between;
		}

		.body_content {
			width: 100%;
			height: calc(100% - 110px);
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.content {
			width: 1900px;
			height: 790px;
			position: absolute;
			display: flex;
			justify-content: space-between;
			box-sizing: border-box;

			.left {
				height: 100%;
				width: calc(22% - 10px);
				background-size: 100% 100%;
				position: relative;
				overflow: hidden;
			}

			.center {
				height: 100%;
				width: 1070px;
				position: relative;
				overflow: hidden;
			}

			.right {
				height: 100%;
				width: calc(22% - 10px);
				padding-top: 4px;
				background-size: 100% 100%;
				position: relative;
				overflow: hidden;
			}
		}
	}

	.yjwz_box {
		width: 32%;
		height: 100%;
		position: relative;
		padding: 12px 8px 0px 8px;

		.tit_bg {
			display: flex;
			align-items: center;
			height: 30px;
			margin-bottom: 2px;

			position: absolute;
			top: -2px;
			z-index: 99;
			left: 26px;
			padding-left: 6px;
			width: 90px;
			text-align: center;
			background: rgb(8, 38, 78);
		}

		.yjwz_table {
			width: 100%;
			height: calc(100% - 0px);
			padding-top: 12px;
			border: 1px solid #073f97;
			overflow-y: scroll;
			color: white;

			.yjwz_bg {
				width: 100%;
				height: 100%;

				.wz_item {
					width: 100%;
					padding: 4px 8px;
					margin-bottom: 6px;
				}
			}
		}
	}

	.ycqk_box {
		width: 100%;
		height: 442px;
		position: relative;
		padding: 12px 8px 0px 8px;
		border-bottom: 1px solid #073f97;

		.tit_bg {
			display: flex;
			align-items: center;
			height: 16px;
			margin-bottom: 2px;

			position: absolute;
			top: 6px;
			z-index: 99;
			left: 26px;
			padding-left: 6px;
			width: 90px;
			text-align: center;
			background: rgb(8, 38, 78);
		}
	}

	.yc_table {
		border-top: 1px solid #073f97;
		padding-top: 12px;
		width: 100%;
		overflow-y: scroll;
		color: white;
		height: calc(100% - 0px);

		.table_item {
			width: 100%;
			cursor: pointer;
			height: 28px;
			color: white;
			justify-content: space-evenly;
			font-size: 12px;
		}
	}

	.content .left {
		.title {
			color: #fff;
			position: absolute;
			left: 40px;
			font-size: 20px;
			line-height: 35px;
			font-weight: 600;
		}

		.zyzffb {
			color: #fff;
			position: absolute;
			width: 100%;
			height: calc(100% - 0px);
			background-color: rgb(8, 38, 78);
			padding-top: 4px;


			.box_zfsj {
				width: 220px;
				height: 100px;
				position: relative;
				padding: 12px 8px 0px 8px;

				.tit_bg {
					height: 16px;
					margin-bottom: 2px;
					display: flex;
					align-items: center;
					position: absolute;
					top: 6px;
					z-index: 99;
					left: 26px;
					padding-left: 6px;
					width: 90px;
					text-align: center;
					background: rgb(8, 38, 78);
				}

				.zfsj_data {
					width: 100%;
					height: calc(100% - 0px);
					border-top: 1px solid #073f97;
					display: flex;
					flex-wrap: wrap;
					padding-top: 12px;

					.zfsj_item {
						width: 97px;
						height: 16px;
						display: flex;
						font-size: 12px;
						align-items: center;
						color: white;
						overflow-y: scroll;
					}
				}
			}

			.bot_item {
				width: 220px;
				height: 100px;
				position: relative;
				padding: 12px 8px 0px 8px;

				.tit_bg {
					height: 16px;
					margin-bottom: 2px;
					display: flex;
					align-items: center;
					position: absolute;
					top: 6px;
					z-index: 99;
					left: 26px;
					padding-left: 6px;
					width: 90px;
					text-align: center;
					background: rgb(8, 38, 78);
				}

				.zdrt_data {
					width: 100%;
					height: calc(100% - 0px);
					border-top: 1px solid #073f97;
					padding-top: 12px;

					.items {
						width: 120px;
						border: 1px solid #ff7600;
						height: 32px;
						border-radius: 40px;
						margin-right: 6px;
						font-size: 14px;
						color: #ff7600;

						.tits {
							margin-right: 4px;
						}
					}
				}
			}

			.bot_item2 {
				width: 220px;
				height: 100px;
				position: relative;
				padding: 12px 8px 0px 8px;

				.tit_bg {
					display: flex;
					align-items: center;
					height: 16px;
					margin-bottom: 2px;
					position: absolute;
					top: 6px;
					z-index: 99;
					left: 26px;
					padding-left: 6px;
					width: 90px;
					text-align: center;
					background: rgb(8, 38, 78);
				}

				.box_cydj {
					height: calc(100% - 0px);
					width: 100%;
					padding: 12px 12px 0 12px;
					border-top: 1px solid #073f97;

					.cydj_data {
						height: 100%;
						width: 100%;



						.data_item,
						.data_items {
							width: 86px;
							font-size: 13px;
							height: 32px;
							border: 2px solid rgb(255, 255, 255);
							border-radius: 20px;
							justify-content: center;

							color: rgb(255, 255, 255);

							.item_text {
								display: inline-block;
								margin-right: 6px;
							}
						}

						.data_item:nth-child(2) {
							color: rgb(18 183 18);
							border-color: rgb(18 183 18);
						}

						.data_item:nth-child(3) {
							color: rgb(217, 2, 102);
							border-color: rgb(217, 2, 102);
						}

						.data_item:nth-child(4) {
							color: rgb(209, 219, 10);
							border-color: rgb(209, 219, 10);
						}
					}
				}
			}
		}

	}


	.yjya_box {
		position: relative;
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		padding: 4px 16px 0 16px;
		border: 1px solid #073f97;
		padding-top: 12px;
		height: calc(100% - 0px);

		.yjya_left {
			width: 90px;
			height: 160px;

			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.img_box {
				width: 100%;
				height: 40px;

				img {
					width: 100%;
					height: 100%;
				}
			}
		}

		.yjya_cen {
			width: 90px;
			height: 160px;

			display: flex;
			align-items: center;
			justify-content: center;

			.img_box {
				width: 90%;
				height: 80px;

				img {
					width: 100%;
					height: 100%;
				}
			}
		}

		.yjya_rfiht {
			width: 90px;
			height: 160px;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.img_box {
				width: 100%;
				height: 40px;

				img {
					width: 100%;
					height: 100%;
				}
			}
		}
	}

	.center_db {
		width: 100%;
		height: 246px;
		border: 1px solid #073f97;
		background-color: rgb(8, 38, 78);
		justify-content: space-between;
		margin-bottom: 2px;
		display: flex;
		box-sizing: border-box;
		padding: 6px;


		.Items {
			width: 32%;
			height: 100%;
			position: relative;
			padding: 12px 8px 0px 8px;

			.tit_bg {
				display: flex;
				align-items: center;
				height: 16px;
				margin-bottom: 2px;
				position: absolute;
				top: 6px;
				z-index: 99;
				left: 26px;
				padding-left: 6px;
				width: 110px;
				text-align: center;
				background: rgb(8, 38, 78);
			}

			.tjd_box {
				color: white;
				width: 100%;
				height: calc(100% - 0px);
				border: 1px solid #073f97;
				padding-top: 12px;

				.item_sw {
					width: 100%;
					height: 100%;
					box-sizing: border-box;
					color: white;

					.tjd_conten {
						width: 100%;
						padding-top: 4px;
						height: calc(100% - 0px);

						.colmm_box {
							text-align: center;
						}
					}
				}
			}
		}
	}

	.center .cc-top {
		width: 100%;
		height: calc(100% - 246px);
		background: url(../assets/images/jx.png) no-repeat no-repeat;
		background-size: 100% 100%;
		margin-top: 0;
		display: flex;
		flex-direction: column;
	}


	.right {
		background-color: rgb(8, 38, 78);
	}

	.content .right {
		.title {
			color: #fff;
			font-size: 20px;
			line-height: 35px;
			font-weight: 600;
			position: absolute;
			left: 40px;
			height: 36px;
		}

		.mjsj_box {
			width: 100%;
			height: 100px;
			position: relative;
			padding: 12px 8px 0px 8px;

			.tit_bg {
				display: flex;
				align-items: center;
				height: 16px;
				margin-bottom: 2px;
				position: absolute;
				top: 8px;
				z-index: 99;
				left: 26px;
				padding-left: 6px;
				width: 90px;
				text-align: center;
				background: rgb(8, 38, 78);
			}

			.mjsj_data {
				height: calc(100% - 0px);
				width: 100%;
				box-sizing: border-box;
				padding: 0px 4px;
				border-top: 1px solid #073f97;
				padding-top: 12px;
				color: rgb(255, 255, 255);
				font-weight: bold;
				font-size: 14px;
			}
		}

		.jrzb {
			width: 100%;
			height: 119px;
			overflow: hidden;

			position: relative;
			padding: 12px 8px 0px 8px;

			.tit_bg {
				height: 30px;
				margin-bottom: 2px;
				display: flex;
				align-items: center;

				position: absolute;
				top: -2px;
				z-index: 99;
				left: 26px;
				padding-left: 6px;
				width: 90px;
				text-align: center;
				background: rgb(8, 38, 78);
			}

			.jrzb_mian {
				width: 100%;
				height: 450px;
				border-top: 1px solid #073f97;
				padding-top: 18px;
			}

			.jrzb-table {
				height: 100%;
				overflow: hidden;
				padding-left: 2px;
				overflow-y: scroll;
				scrollbar-width: none;
			}
		}
	}

	.zw_box {
		width: 32%;
		height: 100%;
		position: relative;
		padding: 12px 8px 0px 8px;

		.tit_bg {
			height: 16px;
			display: flex;
			align-items: center;
			margin-bottom: 2px;

			position: absolute;
			top: 8px;
			z-index: 99;
			left: 26px;
			padding-left: 6px;
			width: 90px;
			text-align: center;
			background: rgb(8, 38, 78);
		}

	}

	/**
弹窗样式修改
 */

	::v-deep .el-dialog {
		background-color: rgb(8, 32, 78) !important;
		height: 810px;
		padding: 0 0px;

		.el-dialog__header {
			// display: none;
			padding: 0px !important;
			height: 42px;
			color: white;
			line-height: 42px;
			text-align: center;
			border-bottom: 1px solid rgb(5, 112, 146);

			.el-dialog__title {
				color: white;
				transform: translateX(12px);
				display: inline-block;
				font-size: 16px;
			}
		}

		.el-dialog__headerbtn {
			width: auto;
			height: auto;
			right: 24px;
			top: 8px;
		}
	}

	/**
 抽屉样式修改
  */
	::v-deep .el-drawer {
		background-color: rgb(8, 32, 78) !important;
	}

	::v-deep .el-drawer__header {
		margin-bottom: 0px !important;
		padding: 10px 16px;
		color: white;
		border-bottom: 1px solid rgb(5, 112, 146);
	}

	::v-deep .el-drawer__body {
		padding: 0 16px !important;
	}
</style>